#include <stdint.h>

//INTERRUPT DEF
#define NVIC_CTRL_ADDR (*(volatile unsigned *)0xe000e100)
#define AHB_BASE  0x40000000
//WATERLIGHT DEF
typedef struct{
    volatile uint32_t Waterlight_MODE;
    volatile uint32_t Waterlight_SPEED; 
}WaterLightType;

#define WaterLight ((WaterLightType *)AHB_BASE)

//GPIO DEF
typedef struct{
    volatile uint32_t oData; 
		volatile uint32_t iData;
	  volatile uint32_t outEn;
}GPIOType;

#define GPIO_BASE 0x40020000
#define GPIO ((GPIOType *)GPIO_BASE)


//UART DEF
typedef struct{
    volatile uint32_t UARTRX_DATA;
    volatile uint32_t UARTTX_STATE;
    volatile uint32_t UARTTX_DATA;
}UARTType;

#define UART_BASE 0x40000010
#define UART ((UARTType *)UART_BASE)
void SetWaterLightMode(int mode);
void SetWaterLightSpeed(int speed);
void Delay(int interval);
void SPIstart(void);
void SPIwrite( char data,int IO_en);
unsigned char SPI_read(void);
char SPI_WriteReadByte(char data);
void SPIHandle();
void UARTString(char *stri);
